<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="../css/public.css">
<title>Insert title here</title>
</head>
<body>
<div id="maincontent">
<div id="headBlue">
<%
try
{
    String classId = (String) session.getAttribute("classId");
    String managerName = (String) session.getAttribute("managerName");
    if(managerName == null)
    	out.println("<script>alert('没有登录,请返回登录界面进行登录！');window.location='../managerLogin.html';</script>");
    //out.println(classId);
    Class.forName("com.mysql.jdbc.Driver").newInstance();
   	Connection con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/classfee", "root", "1234");
   	Statement stmt = con.createStatement();
   	ResultSet rst = stmt.executeQuery("SELECT * FROM  tb_class where (classId='"+classId+"')");%>
   	<ul class="nopoint"><li><img src="../image/head.png" style="width:30px;height:30px"/><a id="maname" href="../tb_manager/managerupdate1.jsp" style="color:white;text-decoration: none;"><% out.println(managerName);%></a><a href="../managerlogout.jsp" style="margin-left:89%;color:white">退出登录</a></li></ul>
   	</div>
   	<div id="infotable">
   	<table  border="1" rules=rows  style="margin-left:37%;">
		<tr align="center">
			<td>班级Id</td>
	        <td>班级名称</td>
		    <td>班级人数</td>
		</tr>
		<%while(rst.next()){%>
		<tr align="center">
		<td><%out.println(classId);%></td>
		<td><%out.println(rst.getString("className"));%></td>
		<td><%out.println(rst.getString("classSize"));%></td>
		</tr>
		<%}%>
		<%rst.close(); %>
	</table>
	<%ResultSet srt = stmt.executeQuery("SELECT * FROM  tb_student where (classId='"+classId+"')");%>
	 	<table border="1" rules=rows  style="margin-top:20px;margin-left:37%">
		<tr align="center">
			<td>学号</td>
	        <td>姓名</td>
		    <td>性别</td>
		</tr>
		<%while(srt.next()){%>
		<tr align="center">
		<td><%out.println(srt.getString("stuId"));%></td>
		<td><%out.println(srt.getString("stuName"));%></td>
		<td><%out.println(srt.getString("stuSex"));%></td>
		</tr>
		<%}%>
		<%srt.close(); 
		stmt.close();
		con.close();
		%>
	</table>
	</div>
<%}
catch(Exception e)
{
	System.out.println(e.getMessage());
}
%>
</div>
</body>
</html>